home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / new_file / falcon / dsptrack / dsptrack.lzh / TEMPODSP.GFA (.txt) < prev    next >
GFA-BASIC Atari  |  1994-06-17  |  1KB  |  49 lines

  1. '
  2. ' Génération de la table des tempos pour la routine soundtracker DSP
  3. '
  4. DIM tablo%(255-32)
  5. adr%=V:tablo%(0)
  6. '
  7. FOR tempo&=32 TO 255
  8.   '
  9.   freq#=50/125*tempo&
  10.   '
  11.   frq#=500
  12.   frq#=@search_frq(1,4)
  13.   frq#=@search_frq(2,10)
  14.   frq#=@search_frq(3,16)
  15.   frq#=@search_frq(4,50)
  16.   frq#=@search_frq(5,64)
  17.   frq#=@search_frq(6,100)
  18.   frq#=@search_frq(7,200)
  19.   '
  20.   realfreq#=frq#/4
  21.   sample_length&=ROUND(49169/realfreq#)+1
  22.   '
  23.   PRINT USING "  ###  ###.##  ####   ###.##  ###.##   ###  ### ",tempo&,freq#,sample_length&,realfreq#,frq#,timer_control&,timer_data&
  24.   ~INP(2)
  25.   '
  26.   WORD{adr%}=sample_length&
  27.   BYTE{adr%+2}=timer_control&
  28.   BYTE{adr%+3}=timer_data&
  29.   adr%=adr%+4
  30.   '
  31. NEXT tempo&
  32. '
  33. BSAVE "TEMPODSP.TAB",V:tablo%(0),4*(255-32)
  34. '
  35. FUNCTION search_frq(tmr_ctrl&,prediv&)
  36.   '
  37.   freq_div#=2.4576E+06/prediv&
  38.   tmr_data&=freq_div#/(4*freq#)
  39.   newfrq#=2.4576E+06/prediv&/tmr_data&
  40.   '
  41.   IF tmr_data&<256 AND ABS(newfrq#-freq#)<ABS(frq#-freq#) THEN
  42.     timer_control&=tmr_ctrl&
  43.     timer_data&=tmr_data&
  44.     RETURN newfrq#
  45.   ELSE
  46.     RETURN frq#
  47.   ENDIF
  48. ENDFUNC
  49.